package cn.ante.order.service.impl;

import cn.ante.order.domain.OrderProduct;
import cn.ante.order.mapper.OrderProductMapper;
import cn.ante.order.service.IOrderProductService;
import cn.ante.basic.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Nai
 * @since 2022-07-21
 */
@Service
public class OrderProductServiceImpl extends BaseServiceImpl<OrderProduct> implements IOrderProductService {

    @Autowired
    private OrderProductMapper orderProductMapper;
    @Override
    public void pay(OrderProduct orderProduct) {
        orderProductMapper.add(orderProduct);
        // 修改订单的状态
        orderProduct.setState(1);
        orderProduct.setLastPayTime(new Date());
        orderProductMapper.update(orderProduct);
    }
}
